package com.fimmlps.reronge.dto;

import com.fimmlps.reronge.entity.EntrySingle;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;

import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.List;

@Data
@AllArgsConstructor
@NoArgsConstructor
@Accessors(chain = true)
public class EntrySinglePreviewDto {
    //作为百科页面的词条预览内容，包含词条本体信息及其所有Trigger
    //id ID
    private long entrySingleId;

    //title 标题
    private String title;

    //resume 摘要
    private String resume;

    //最后修改时间
    private LocalDateTime updateTime;

    //点击量
    private long clicks;

    //triggers
    private List<EntryTriggerDto> triggers;


    public EntrySinglePreviewDto(EntrySingle single){
        entrySingleId = single.getEntrySingleId();
        title = single.getTitle();
        resume = single.getResume();
        updateTime = single.getUpdateTime();
        clicks = single.getClicks();
        triggers = new ArrayList<>();
    }

    public EntrySinglePreviewDto(EntrySingle single,List<EntryTriggerDto> dtoList){
        this(single);
        this.triggers = dtoList;
    }
}
